package com.blockmeta.bbs.immodule.greendao.repository;

import com.blockmeta.bbs.immodule.dao.ChatMessage;

import java.util.List;

/**
 * 数据访问抽象层，主要是对green dao进行包装，以使如果换一个orm或者sqlite数据驱动的时候可以不影响上层业务逻辑。
 */
public interface IChatMessageRepo {
    boolean addChatMessage(ChatMessage chatMessage, long whoId);

    List<ChatMessage> getAllChatMessage(long whoId);

    void deleteListChatMessage(long whoId, long toId, int type);

    long getMaxMessageIdByUserId(long whoId);

    List<ChatMessage> getTalkListMessage(long whoId);

    int getUncheckedChatMessageCount(long fromId, long whoId, int msgType);

    int getUncheckedGroupMessageCount(long groupId, long whoId);


    void updateChatMessageChecked(long whoId, long friendId);

    void updateGroupMessageCheck(long whoId, long groupId);

    void deleteChatMessageById(Long id);

    void updateChatMessageStick(Long id, boolean openOrDown);

    boolean getCircleStick(long id, Integer type);

    void updateCircleStick(Long circleId, boolean openOrDown);

    void updateChatMessageReaded(Long id, boolean readOrUnread);

    long getUnReadCount(long whoId, long toUserId, int type);

    int getUncheckedMessageCountExceptNoDisturb(long uidInt, List<Long> noDisturbGroupIds);

    int getTalkListMessageSize(long uid);

    void updateMessageStatusToFail(long uidInt);

    boolean isStickMessage(ChatMessage cm);

    ChatMessage getChatMessageByUUid(String uuid, long whoId);

    boolean updateChatMessage(ChatMessage chatMessage);

    void deleteChatMessageByUuid(String uuid, long whoId);

    List<ChatMessage> searchChatMessagePaged(String word, int pageSize, int page, String orderField, String orderType);

    List<ChatMessage> getChatMessageList(long uidInt, long toUserId, int chatType, int fetchSize, long ltMessageId, long gtMessageId);

    List<ChatMessage> getLocChatMessageList(long uidInt, long toUserId, int chatType, int pageSize, long locMessageId);

    List<ChatMessage> getGroupTalkListMessage(int uidInt);

    List<ChatMessage> getPersonalTalkListMessage(int uidInt);

    int getUncheckedUUMessageCount(long uidInt);

    int getUncheckedUCGMessageCountExceptNoDisturb(long uidInt, List<Long> noDisturbGroupIds);
}
